"""
=
M
=

M is a free and open source Python-based templating system. This file is merely a distutils-based installer. For information on how to use, see the documentation_ for distutils installation.

.. _documentation: http://docs.python.org/inst/

"""

import os

from distutils.core import setup

def to_include(search='.'):
    """
    to_include
    ==========
    
    to_include(search='.') -> tuple(packages, files)
    Generate a list of directory ``search`` packages and data files to include in a distutils setup. Heavily inspired by Django's setup.py, so kudos for the great idea!
    
    """
    packages, data = [], []
    for path, dirs, files in os.walk(search):
        for directory in dirs:
            if directory.startswith('.'):
                del dirs[dirs.index(directory)]

        if '__init__.py' in files:
            packages.append(path.replace('/', '.'))
        else:
            data.append((path, [os.path.join(path, item) for item in files]))

    return packages, data

packages, data_files = to_include('m')
setup(
    name='M',
    version='0.1',
    author='Veracon',
    author_email='veracon@veracon.net',
    url='http://dev.antisen.se/m',
    description='A free and open source Python-based templating system.',
    packages=packages,
    data_files=data_files
)
